<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function res (a,b){
            var res = 0;
            // a+1取不到自身
        for(i=a+1;i<b;i++){
            res +=i;
        }
        console.log(res);
        };
        // 调用，传参
        res(30,40);
    </script>
</body>
</html>